﻿using System;
using System.Collections.Generic;
using viBlog.Classes;
using viBlog.Controllers;
using visinia.SmartEngine;
using visinia.SmartEngine.Modules;

public partial class Modules_viBlog_LatestPosts_LatestPosts : WebModule
{
    protected void Page_Load(object sender, EventArgs e)
    {
        List<Post> list = DataFilterController.GetFilteredData(ModuleId);
        if (list == null)
            return;
        LatestPostsList.DataSource = list;
        LatestPostsList.DataBind();
        WebPageController.AddRssFeedLink(Page, BlogController.BlogName + "(RSS)", WebRoots.GetWebRoot + BlogController.BlogUrlSeparator + "/rss.aspx");
    }

    public string TrimSummary(string summary)
    {
        if (summary.Length > 70)
            return WebHelpers.StripHtml(summary.Remove(70)) + "...";
        return WebHelpers.StripHtml(summary);
    }
}
